<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<script src='/static/admin/js/common_index.js'></script>
<script src='/static/admin/js/tableList.js'></script>
<style>
    .jingchabut{position: absolute;right: 20px;top: 10px;height: 30px;line-height: 25px;background: #2272eb;color: #fff;width: 90px;border-radius: 6px;}
    .jingchabut:hover{background: #FFFFFF;color: #2272eb;}
    .bbtt{font-size: 16px;margin-top: 15px}
    .layui-table-page{text-align: right;!important;}
</style>
<body id="xiangqingPage">
<div id="xiangqingBox" style="padding-top: 10px;padding-bottom: 150px">
    <div style="margin: 10px 0 0 15px">
        <div style="width: 400px;float: left">
            <div id="gofuer" class="xmselect_div">
                <div class="xmselect_title">请选择</div>
            </div>
        </div>
        <div style="float: left;margin-left: 15px">
            <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="jingChaButton"><i class="layui-icon layui-icon-search"></i>查询</button>
        </div>
    </div>
    <div style="clear: both"></div>

    <div class="main-container xiadiv layui-hide">
        <div class="bbtt"><b>工程负责人资金余额</b></div>
        <div class="tongbox tongbox3">
            <div class="tuo">
                <div class="tit">工程负责人可用资金余额(元)</div>
                <div class="con" id="tong_gofuerkeyong"></div>
            </div>
            <div class="tuo">
                <div class="tit">其中工程回款可用余额(元)</div>
                <div class="con colorlan" id="tong_hougonghuikeyong"></div>
            </div>
            <div class="tuo">
                <div class="tit">其中工程负责人预收款可用余额(元)</div>
                <div class="con colorlan" id="tong_hougongyukeyong"></div>
            </div>
        </div>


        <div class="bbtt"><b>工程负责人待收情况</b></div>
        <div class="tongbox tongbox5">
            <div class="tuo">
                <div class="tit">待收取合计(元)</div>
                <div class="con" id="tong_daishou_all"></div>
            </div>
            <div class="tuo">
                <div class="tit">其中待收取服务费合计(元)</div>
                <div class="con colorlan" id="tong_daishou_fuwu"></div>
            </div>
            <div class="tuo">
                <div class="tit">其中待收取税款保证金及利息合计(元)</div>
                <div class="con colorlan" id="tong_daishou_shuifei"></div>
            </div>
            <div class="tuo">
                <div class="tit">其中待收取快递费合计(元)</div>
                <div class="con colorlan" id="tong_daishou_kuaifei"></div>
            </div>
            <div class="tuo">
                <div class="tit">其中待收取借款及利息合计(元)</div>
                <div class="con colorlan" id="tong_daishou_gongjie"></div>
            </div>
        </div>


        <div class="table-box ">
            <script type="text/html" id="toolbarDemo">
                <div class="bbtt"><b>工程负责人资金余额</b></div>
            </script>
            <table id="datalist" lay-filter="datalist"></table>
        </div>
    </div>
</div>
<script>
    var public_limits = [10,30,50,'全部'];
    var public_limit = 10;
    var public_gofuer='';

    var param_jieer = decodeURI(getQueryVariable('gofuer') || '') || '';


    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form,
            soulTable = layui.soulTable, element = layui.element;
        rel_jing_cha_engin();

        if(param_jieer){
            public_gofuer = param_jieer;
            $(".xiadiv").removeClass('layui-hide');
            rel_engin_gofuer_tong();
            rel_engin_gofuer_lie();
        }

        function rel_jing_cha_engin() {
            facade.ajax({url: ask_engin_gofuer_cha}).done(function (res) {
                if (res.code === 2000) {
                    var golist = res.data.golist;

                    xmselect_dan('gofuer', golist, public_gofuer)

                    render_from();
                }
            });
        }


        $("#jingChaButton").click(function () {
            public_gofuer = $("input[name=gofuer]").val() || '';
            if (!public_gofuer) {
                $(".xiadiv").addClass('layui-hide');
                facade.error("请选择工程负责人信息");
                return false;
            }else{
                $(".xiadiv").removeClass('layui-hide');
            }
            rel_engin_gofuer_tong();
            rel_engin_gofuer_lie();
        });

        function rel_engin_gofuer_tong() {
            facade.ajax({url: ask_engin_gofuer_tong, data:{gofuer:public_gofuer}}).done(function (res) {
                if (res.code === 2000) {
                    var data = res.data;

                    $("#tong_gofuerkeyong").text(parseFormatNum(data.gofuerkeyong));

                    $("#tong_hougonghuikeyong").off('click');
                    $("#tong_hougonghuikeyong").text(parseFormatNum(data.hougonghuikeyong)).click(function () {
                        openNavPage('工程回款资金池信息','hou_chi_gonghui/index.php?gofuer='+encodeURI(public_gofuer));
                    });

                    $("#tong_hougongyukeyong").off('click');
                    $("#tong_hougongyukeyong").text(parseFormatNum(data.hougongyukeyong)).click(function () {
                        openNavPage('预收款资金池信息','hou_chi_gongyu/index.php?gofuer='+encodeURI(public_gofuer));
                    });





                    $("#tong_daishou_all").text(parseFormatNum(data.daishou_all));

                    $("#tong_daishou_fuwu").off('click');
                    $("#tong_daishou_fuwu").text(parseFormatNum(data.daishou_fuwu)).click(function () {
                        open_page('../hou_gonghui/koulei_fuwu.php?tthide=1&gofuer='+encodeURI(public_gofuer),'待收取劳务分包服务费','80%','80%');
                    });

                    $("#tong_daishou_shuifei").off('click');
                    $("#tong_daishou_shuifei").text(parseFormatNum(data.daishou_shuifei)).click(function () {
                        open_page('../hou_gonghui/koulei_shuifei.php?tthide=1&gofuer='+encodeURI(public_gofuer)+"&daodt="+encodeURI(data.daodt),'待收取税款(含利息)','80%','80%');
                    });

                    $("#tong_daishou_kuaifei").off('click');
                    $("#tong_daishou_kuaifei").text(parseFormatNum(data.daishou_kuaifei)).click(function () {
                        open_page('../hou_gonghui/koulei_kuaifei.php?tthide=1&gofuer='+encodeURI(public_gofuer),'待收取快递费','80%','80%');
                    });

                    $("#tong_daishou_gongjie").off('click');
                    $("#tong_daishou_gongjie").text(parseFormatNum(data.daishou_gongjie)).click(function () {
                        open_page('../hou_gonghui/koulei_gongjie.php?tthide=1&gofuer='+encodeURI(public_gofuer)+"&daodt="+encodeURI(data.daodt),'工程负责人借款(含利息)','80%','80%');
                    });


                    render_from();
                }
            });
        }


        function rel_engin_gofuer_lie() {
            var mytable = table.render({
                elem: "#datalist",id: "datalist"
                ,url: facade.url(ask_engin_gofuer_lie),where: {gofuer:public_gofuer}, page: true
                ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
                ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
                ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
                ,text: TabInit.text,totalRow: true
                ,parseData: function (res) {
                    render_from();
                    return {
                        "code": res.code,
                        "msg": res.message,
                        "count": res.data.data.total,
                        "data": res.data.data.data
                    };
                }
                , cols: [[
                    {type:'numbers',title:'序号',totalRowText: '合计'}
                    ,{field:'name',title:'工程名称',templet: function(d){
                            return '<span class="colorlan" onclick="openPage(\'../engin/show.php?id='+d.id+'\')">'+d.name+'</span>';
                        }}
                    ,{field: 'qiandt', title: '合同签订日期'}
                    ,{field:'shimoney',title:'合同价(元)',totalRow: true,templet: function(d){return parseFormatNum(d.shimoney);}}
                    ,{field:'shijiemoney',title:'工程结算金额(元)',totalRow: true,templet: function(d){return parseFormatNum(d.shijiemoney);}}
                    ,{field:'piaokaifee',title:'已开具销项发票金额(元)',totalRow: true,templet: function(d){return parseFormatNum(d.piaokaifee);}}
                    ,{field:'piaokairatefee',title:'销项发票税额(元)',totalRow: true,templet: function(d){return parseFormatNum(d.piaokairatefee);}}
                    ,{field:'gonghuimoney',title:'累计回款金额(元)',totalRow: true,templet: function(d){return parseFormatNum(d.gonghuimoney);}}
                    ,{field:'leihuibi',title:'工程回款比例(%)',templet: function(d){return parseFormatNum(d.leihuibi);}}
                    ,{field:'nohuifee',title:'工程未回款金额(元)',totalRow: true,templet: function(d){return parseFormatNum(d.nohuifee);}}
                    ,{field:'nohuibi',title:'工程未回款比例(%)',templet: function(d){return parseFormatNum(d.nohuibi);}}
                    ,{field:'koushuifee',title:'税款保证金已收取(元)',totalRow: true,templet: function(d){return parseFormatNum(d.koushuifee);}}
                    ,{field:'koufuwufee',title:'劳务分包服务费已收取(元)',totalRow: true,templet: function(d){return parseFormatNum(d.koufuwufee);}}
                    ,{field:'koukuaifee',title:'快递费已收取(元)',totalRow: true,templet: function(d){return parseFormatNum(d.koukuaifee);}}
                    ,{field:'kouqitafee',title:'其他费已收取((元)',totalRow: true,templet: function(d){return parseFormatNum(d.kouqitafee);}}
                    ,{field:'piaoshoumoney',title:'已登记进项发票金额((元)',totalRow: true,templet: function(d){return parseFormatNum(d.piaoshoumoney);}}
                    ,{field:'piaoshouratefee',title:'进项发票税额((元)',totalRow: true,templet: function(d){return parseFormatNum(d.piaoshouratefee);}}
                    ,{field:'hougongshuimoney',title:'已抵扣进项发票税额((元)',totalRow: true,templet: function(d){return parseFormatNum(d.hougongshuimoney);}}
                    ,{field:'nodishuifei',title:'未抵扣进项发票税额((元)',totalRow: true,templet: function(d){return parseFormatNum(d.nodishuifei);}}
                    ,{field:'yizhifee',title:'工程款已支付工程负责人金额((元)',totalRow: true,templet: function(d){return parseFormatNum(d.yizhifee);}}
                ]]
                , done: function (res) {
                    soulTable.render(this);
                }
            });
        }


    })









</script>
</body>
</html>




